#ifndef __PROPERTY_H__
  #define __PROPERTY_H__

using namespace std;

//! Property pattern

/*!
A simple implementation for property pattern.

Implementation date: 2007

Usage:

\code
class my_class {
public:
  property<int> count;
};

my_class mc;
mc.count(10);
cout << mc.count() << endl;
\endcode
*/

template <class T>
class property {
private:
  T property_value;

public:
  //! returns the content of the property
  T &operator*() {
    return property_value;
  } // operator*

  //! returns the content of the property
  const T &operator*() const {
    return &property_value;
  } // operator*

  //! returns the value of the property
  const T &operator()() const {
    return property_value;
  } // operator()

  //! sets the value of the property
  void operator()(const T &value) {
    this->property_value = value;
  } // operator()

  //! constructor
  explicit property(const T &init_value) : property_value(init_value) {
  } // property

  //! destructor (non-virtual: please do not inherit from this class)
  ~property() {
  } // ~property
}; // class property

#endif
